import { Behaviour } from "./engine/Behaviour";
import { Transform } from "./engine/Transform";

export class UIfollow extends Behaviour {

    indexX: number

    onStart() {
        this.indexX = this.gameObject.getBehaviour(Transform).x
    }

    onUpdate() {
        const mainCamera = this.engine.getGameObject('camera')
        if (mainCamera) {
            this.gameObject.getBehaviour(Transform).x = mainCamera.getBehaviour(Transform).x + this.indexX
        }
    }
}